package cn.pconline.autoclub.util.ubb.node;

import cn.pconline.autoclub.util.ubb.EscapeUtils;
import cn.pconline.autoclub.util.ubb.Node;

/**
 * 论坛某个帖子中的图片列表专用
 * @author xiawen
 */
public class ImgNode4 extends AbstractNode {

    public ImgNode4() {
    }

    private ImgNode4(String name, String attribute) {
        super.name = name;
        super.attribute = attribute;
    }

    @Override
    public StringBuilder getText(java.util.LinkedList<Node> stack) {
        return new StringBuilder(text).append(",");
    }

    @Override
    public StringBuilder getImgText(java.util.LinkedList<Node> stack) {
        return new StringBuilder(imgText).append(",");
    }

    @Override
    public void appendText(CharSequence text) {
        if (attribute == null) {
            EscapeUtils.appendAttribute(text, super.imgText);
        } else {
            EscapeUtils.appendHtml(text, super.imgText);
        }
    }

    @Override
    public Node copyWithoutText() {
        return new ImgNode4(name, attribute);
    }

    @Override
    public Node build(String name, String attribute) {
        return new ImgNode4(name, attribute);
    }
}